<?php
 
use yii\helpers\Html; 
use common\models\BaseImg;
use yii\bootstrap\ActiveForm;

?>
<div class="row">
    <div style="color:red;font-size: 15px;font-weight:bold;">&nbsp;&nbsp;&nbsp;上传的图片大小不能超过1M！</div>
<?php 
	$image = (!$model->isNewRecord && $model->img_id > 0) ? !is_null(BaseImg::findOne($model->img_id)) ? BaseImg::findOne($model->img_id) : new BaseImg() : new BaseImg();
	$form = new ActiveForm();
?>
<div class="col-md-3" style="margin: 100px 20px 20px 20px;">
<?php if ($model->isNewRecord) {?>
<?= $form->field($model, 'img_id')->hiddenInput(['value' => 0])?>
<?php } else {?>
<?= $form->field($model, 'img_id')->hiddenInput()?>
<?php }?>
<?= $form->field($image, 'img_url')->fileInput([
	
])?>

</div>
<div class="col-md-8">

    <div>
        <span><h4></h4></span>
        <?php if (!$model->isNewRecord && $model->img_id > 0) {?>
                <img id="ImgPr" src="<?= $model->img;?>" width="200px" height="190px" />		
        <?php } else {?>
                <img id="ImgPr"  width="262px" height="192px"/>
        <?php }?>
    </div>
</div>
</div>

